package homework12月8号.homework1.h11;

import java.lang.reflect.Field;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("czxy.homework.h11.Student");
        Field f = aClass.getDeclaredField("name");
        f.setAccessible(true);
        Object o = aClass.newInstance();
        f.set(o,"小虎");
        Object o1 = f.get(o);
        System.out.println(o1);
        Field age = aClass.getDeclaredField("age");
        age.setAccessible(true);
        age.set(o,25);
        Object o2 = age.get(o);
        System.out.println(o2);
    }
}
